<!DOCTYPE html>

<html>
    <head>
        <title>sssweb-svn提交记录</title>
        <meta charset="utf-8">
        <style>
        	body { margin:0; font-family:Simsun;}
        	a,a :visited { color:#06c; text-decoration:none;}
        	h1 { margin:0 auto; text-align:center;}
        	.content { width:1000px;  border:1px solid; margin:0 auto; padding:0 40px;}
        	font { font-size:9px; color:#666; margin-left:30px;}
        	.span1 { display:inline-block; margin-top:20px;}
        	select{ width:286px; height:20px; }
        	.text { width:450px; height:20px; }
        	.div1 {width:480px; height:400px; float:left; margin:20px 20px 0 30px;}
        	#btn { margin-left:30px;}
        	#ul1 { width:990px; height:160px; margin:10px 0; border:1px solid #ccc; padding:5px; overflow:scroll; white-space:nowrap; list-style:none;}
        	#ul2 { width:990px; height:220px; border:1px solid #ccc; padding:5px; margin:5px 0; overflow:scroll; white-space:nowrap; list-style:none;}
        	.liClickColor { background:#8FBC8F;}
			.liOverColor { background:#ccc;}
			#copy,#export { float:right; margin-left:10px;}
			.code_add { display:inline-block; width:1500px; height:15px; background:#a8ccf0; margin:-2px; padding:0;}
			.code_modify { display:inline-block; width:1500px; height:15px; background:#ffba77; margin:-2px; padding:0;}
        </style>
        <script src="/sssweb2/public/javascripts/ZeroClipboard.js"></script>
        <script src="/sssweb2/public/javascripts/utils.js"></script>
        <script>
        	window.onload=function()
        	{
        		var oTypeSelect = document.getElementById('project');
        		initSelect(oTypeSelect);
        		var btnSync=document.getElementById('btnSync');
        		btnSync.onclick=sync;
        	}
        	/*
        	 *开始同步
        	*/
        	function sync()
        	{
        		var oTypeSelect = document.getElementById('project');
        		var index = oTypeSelect.selectedIndex; // 选中索引
        		if(index<=0)
        		{
        			alert("请选择对应的项目!");
        			return;
        		}
        		var id=oTypeSelect.options[index].value;
        		var txtmemo=document.getElementById('txtmemo');
        		txtmemo.value=txtmemo.value+"\n"+"开始同步";
        		syncProject(id)
        	}
        	function initSelect(oTypeSelect)
        	{
        		var queryProjectUrl="/sssweb2/SvnMngrController/search.do";
        		var param="pageNum=1&pageSize=100";
        	    ajax(
        	        queryProjectUrl,
        	        param,
        	        function(data){
        	        	var data=JSON.parse(data);
        	            for(var i = 0; i < data.rows.length; i++){
        	            	var oOption = document.createElement('option');
	    					oOption.innerHTML = data.rows[i].project;
	    					oOption.value = data.rows[i].id;
	    					oTypeSelect.appendChild(oOption);
        					
        				}
        	        }
        	    );
        	}
        	function syncProject(id)
        	{
        		var queryProjectUrl="/sssweb2/SvnClientController/svn_sync.do";
        		var param="id="+id;
        	    ajax(
        	        queryProjectUrl,
        	        param,
        	        function(data){
        	        	var data=JSON.parse(data);
        	        	var txtmemo=document.getElementById('txtmemo');
                		txtmemo.value=txtmemo.value+"\n"+data.message;
                		txtmemo.value=txtmemo.value+"\n"+"同步完成";
        	        }
        	    );
        	}
        </script>
    </head>
    <body>
    	<div class="content">
    	   
    		<span class="span1">
	    		SVN项目:<select  id="project" name="project">
										<option value="">请选择</option>
		                            </select>
	   		</span>
	   		
	   		<span class="span1">
	    		开始同步:<input type="button" id="btnSync"  value="开始同步"></input>
	   		</span>
    	</div>
    	<div>
    	<textarea  style="height:200px;width:100%" id="txtmemo"></textarea>
    	</div>
    </body>
</html>